package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public final class errorpage_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    Throwable exception = org.apache.jasper.runtime.JspRuntimeLibrary.getThrowable(request);
    if (exception != null) {
      response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=utf-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write('\r');
      out.write('\n');

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<base href=\"");
      out.print(basePath );
      out.write("\">\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n");
      out.write("<title>出现错误</title>\r\n");
      out.write("<link type=\"text/css\" rel=\"stylesheet\" href=\"images/error.css\">\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      out.write("<div class=\"error\">\r\n");
      out.write("\t<div class=\"error_info\">\r\n");
      out.write("\t\t<div class=\"main_info\">\r\n");
      out.write("\t\t\t<table>\r\n");
      out.write("\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t\t<td><img src=\"images/error_ico.gif\" align=\"absmiddle\"></td>\r\n");
      out.write("\t\t\t\t\t<td>\r\n");
      out.write("\t\t\t\t\t\t");

							String code=request.getAttribute("javax.servlet.error.status_code")==null?"":request.getAttribute("javax.servlet.error.status_code").toString();
							if(!code.matches("")){
								if(code.matches("400"))
									out.println("页面请求错误！<br>");
								else if(code.matches("404"))
									out.println("页面不存在！<br>");
								else if(code.matches("500")){
									out.println("内部服务器错误：");
									String exceptionType=request.getAttribute("javax.servlet.error.exception_type")==null?"":request.getAttribute("javax.servlet.error.exception_type").toString();
									if(exceptionType.indexOf("CannotCreateTransactionException")>-1)
										out.println("<span style='color:red;'>数据库链接错误！</span>");
									else if(exceptionType.indexOf("HibernateQueryException")>-1)
										out.println("<span style='color:red;'>查询出错！</span>");
									else
										out.println("<span style='color:red;'>其它错误！</span>");
									out.println("<br><span style='font-size:12px;font-weight:normal;'>详细信息："+request.getAttribute("javax.servlet.error.message")+"</span><br>");
								}
							}
							else{
								String errorinfo=request.getParameter("errorinfo");
								if(errorinfo!=null){
									out.println("内部服务器错误：");
									if(errorinfo.indexOf("CannotCreateTransactionException")>-1)
										out.println("<span style='color:red;'>数据库链接错误！</span>");
									else if(errorinfo.indexOf("HibernateQueryException")>-1)
										out.println("<span style='color:red;'>查询出错！</span>");
									else
										out.println("<span style='color:red;'>其它错误！</span>");
									out.println("<br><span style='font-size:12px;font-weight:normal;'>详细信息："+errorinfo+"</span><br>");
								}
							}
						
      out.write("\r\n");
      out.write("\t\t\t\t\t</td>\r\n");
      out.write("\t\t\t\t</tr>\r\n");
      out.write("\t\t\t</table>\r\n");
      out.write("\t\t</div>\r\n");
      out.write("\t\t<div class=\"help_info\">\r\n");
      out.write("\t\t\t<span>请尝试以下几种方式解决问题：</span>\r\n");
      out.write("\t\t\t<ul>\r\n");
      out.write("\t\t\t\t<li>检查您正在浏览的网址是否正确</li>\r\n");
      out.write("\t\t\t\t<li><a href=\"#\" onClick=\"Javascript:history.go(-1);\">返回</a></li>\r\n");
      out.write("\t\t\t\t<li>如果您是通过点击本站上某一处链接到达了这里的，请随时与系统管理员取得联系，并且我们为此给您带来的不便表示歉意。</li>\r\n");
      out.write("\t\t\t</ul>\r\n");
      out.write("\t\t</div>\r\n");
      out.write("\t</div>\r\n");
      out.write("</div>\r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
